package com.bitcola.security.activity.entity;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;

@Data
@Builder
@Table(name = "ag_admin_v1.user_mining")
@NoArgsConstructor
@AllArgsConstructor
public class UserMining {
    @Column(name = "id")

    @Id
    String id;
    @Column(name = "start_time")

    Date startTime;//挖矿开始时间
    @Column(name = "init_time")

    Date initTime;//创建时间
    @Column(name = "max_last_time")

    long maxLastTime;//最大持续时间,毫秒
    @Column(name = "per_last_time")

    long perLastTime;//最大领取的周期,ms
    @Column(name = "level")

    int level;//级别
    @Column(name = "end_time")

    Date endTime;//结束时间
    @Column(name = "power")

    BigDecimal power;//算力
    @Column(name = "transform")

    BigDecimal transform;//显示算力
    @Column(name = "gained")

    BigDecimal gained;//已收获
    @Column(name = "unit")

    String unit;//算力单位
    @Column(name = "production_coin_code")

    String productionCoinCode;//产出币的名字
    @Column(name = "user_id")

    String userId;//用户id
    @Column(name = "pay_coin_code")

    String payCoinCode;//支付的币种
    @Column(name = "point_id")

    String pointId;
    @Column(name = "name")

    String name;
    public boolean isActive()
    {
        long now=System.currentTimeMillis();
        return               now -  initTime.getTime() <= maxLastTime;

    }
}
